package com.zyh.homework.domain;

import java.util.Date;
import java.util.List;

/**
 * @Author zyh
 * @Date 2024/8/16 17:01
 * @Description
 */

public class User {
    private Integer id;
    private String name;
    private String addr;
    private Integer age;
    private Integer score;
    private Date birth;
    private List<String> hobby;

    public User() {
    }

    public User(Integer id, String name, String addr, Integer age, Integer score, Date birth, List<String> hobby) {
        this.id = id;
        this.name = name;
        this.addr = addr;
        this.age = age;
        this.score = score;
        this.birth = birth;
        this.hobby = hobby;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public List<String> getHobby() {
        return hobby;
    }

    public void setHobby(List<String> hobby) {
        this.hobby = hobby;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", addr='" + addr + '\'' +
                ", age=" + age +
                ", score=" + score +
                ", birth=" + birth +
                ", hobby=" + hobby +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (id != null ? !id.equals(user.id) : user.id != null) return false;
        if (name != null ? !name.equals(user.name) : user.name != null) return false;
        if (addr != null ? !addr.equals(user.addr) : user.addr != null) return false;
        if (age != null ? !age.equals(user.age) : user.age != null) return false;
        if (score != null ? !score.equals(user.score) : user.score != null) return false;
        if (birth != null ? !birth.equals(user.birth) : user.birth != null) return false;
        return hobby != null ? hobby.equals(user.hobby) : user.hobby == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (addr != null ? addr.hashCode() : 0);
        result = 31 * result + (age != null ? age.hashCode() : 0);
        result = 31 * result + (score != null ? score.hashCode() : 0);
        result = 31 * result + (birth != null ? birth.hashCode() : 0);
        result = 31 * result + (hobby != null ? hobby.hashCode() : 0);
        return result;
    }
}
